﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using KingRoad.EPM.PersonnelLogEntity.Model;
using Unis.Framework.Core.Utility;
using KingRoad.EPM.PersonnelLogDAL.SpecialEquipmentService;


namespace KingRoad.EPM.PersonnelLogBLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/2/13 19:57:12
    /// </summary> 
    public class ScmSpecialequipmentUIRule
    {
        private readonly IScmSpecialequipmentService _scmSpecialequipmentService;


        public ScmSpecialequipmentUIRule() { }

        /// <summary> 
        /// construct function... 
        /// </summary> 
        public ScmSpecialequipmentUIRule(IScmSpecialequipmentService scmSpecialequipmentService)
        {
            _scmSpecialequipmentService = scmSpecialequipmentService;
        }


        /// <summary>
        /// 获取特种设备台账信息
        /// </summary>
        /// <returns></returns>
        public List<ScmSpecialequipmentInfo> GetAllSpecialequipment()
        {
            var list = _scmSpecialequipmentService.GetEntityList();
            return list;
        }

        /// <summary>
        /// 根据标段获取特种设备台账信息
        /// </summary>
        /// <param name="section">标段</param>
        /// <returns></returns>
        public List<ScmSpecialequipmentInfo> GetSpecialequipmentBySection(string section)
        {
            string sql = "";
            if (section != "")
                sql = " Se_Section='"+section+"' ";
            var list = _scmSpecialequipmentService.GetEntityList(sql);
            return list;
        }

        /// <summary>
        /// 根据条件查询费用计划信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmSpecialequipmentInfo> GetAllCostplanmainForPage(int numCurrentPage, int numPerPage,
                                                                        string orderByField, out int totalRecord, string sqlCondition)
        {
            var list = _scmSpecialequipmentService.GetEntityListByContionRe(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }

        /// <summary>
        /// 获取特种设备台账信息 根据ID获取
        /// </summary>
        /// <returns></returns>
        public ScmSpecialequipmentInfo GetSpecialequipmentByID(Guid id)
        {
            var list = _scmSpecialequipmentService.GetEntityById(id);
            return list;
        }

        /// <summary>
        /// 添加特种设备台账信息
        /// </summary>
        /// <returns></returns>
        public int AddSpecialequipment(ScmSpecialequipmentInfo AddEntity)
        {
            return _scmSpecialequipmentService.InsertEntity(AddEntity);
        }

        /// <summary>
        /// 删除特种设备台账信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteSpecialequipment(string id)
        {
            return _scmSpecialequipmentService.DeleteEntityByStringID(id);
        }

        /// <summary>
        /// 删除特种设备台账信息(批量删除)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteSpecialequipmentMulti(string id)
        {
            return _scmSpecialequipmentService.DeleteEntityByMultiStringID(id);
        }

        /// <summary>
        /// 添加特种设备台账信息
        /// </summary>
        /// <returns></returns>
        public int UpdateSpecialequipment(ScmSpecialequipmentInfo UpdateEntity)
        {
            return _scmSpecialequipmentService.UpdateEntity(UpdateEntity);
        }

        /// <summary>
        /// 获取所有的特种设备台账信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <returns></returns>
        public List<ScmSpecialequipmentInfo> GetAllSpecialequipment(int numCurrentPage, int numPerPage, string orderByField, out int totalRecord)
        {
            var list = _scmSpecialequipmentService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord);
            return list;
        }

        /// <summary>
        /// 根据条件查询特种设备台账信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmSpecialequipmentInfo> GetSpecialequipmentForSearch(int numCurrentPage, int numPerPage,
                                                                        string orderByField, out int totalRecord, string sqlCondition)
        {
            var list = _scmSpecialequipmentService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }
    }
}

